spry-0.2.vapi 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. /* spry-0.2.vapi generated by valac 0.56.19, do not modify. */
  2. namespace Spry {
  3. namespace Actions {
  4. [CCode (cheader_filename = "spry-0.2.h")]
  5. public class AlterUserAction : Spry.Actions.UserManagementAction {
  6. public AlterUserAction ();
  7. public override async Statum.DirectiveBuilder handle () throws GLib.Error;
  8. protected virtual string date_of_birth_required_message { get; }
  9. protected virtual string duplicate_email_message { get; }
  10. protected virtual string duplicate_user_message { get; }
  11. protected virtual string duplicate_username_message { get; }
  12. protected virtual string invalid_date_of_birth_message { get; }
  13. protected virtual string invalid_email_message { get; }
  14. protected virtual string name_required_message { get; }
  15. protected virtual string password_too_short_message { get; }
  16. protected virtual string self_alter_message { get; }
  17. protected virtual string update_failed_message { get; }
  18. protected virtual string user_required_message { get; }
  19. protected virtual string user_updated_message { get; }
  20. protected virtual string username_too_short_message { get; }
  21. }
  22. [CCode (cheader_filename = "spry-0.2.h")]
  23. public class ChangePasswordAction : Statum.StatumAction {
  24. public ChangePasswordAction ();
  25. public override async Statum.DirectiveBuilder handle () throws GLib.Error;
  26. protected virtual string change_failed_message { get; }
  27. protected virtual string current_password_invalid_message { get; }
  28. protected virtual string current_password_required_message { get; }
  29. protected virtual string login_uri { get; }
  30. protected virtual string password_changed_message { get; }
  31. protected virtual string password_mismatch_message { get; }
  32. protected virtual string password_too_short_message { get; }
  33. }
  34. [CCode (cheader_filename = "spry-0.2.h")]
  35. public class DeleteUserAction : Spry.Actions.UserManagementAction {
  36. public DeleteUserAction ();
  37. public override async Statum.DirectiveBuilder handle () throws GLib.Error;
  38. protected virtual string delete_failed_message { get; }
  39. protected virtual string self_delete_message { get; }
  40. protected virtual string user_deleted_message { get; }
  41. protected virtual string user_required_message { get; }
  42. }
  43. [CCode (cheader_filename = "spry-0.2.h")]
  44. public class GrantPermissionAction : Spry.Actions.UserManagementAction {
  45. public GrantPermissionAction ();
  46. public override async Statum.DirectiveBuilder handle () throws GLib.Error;
  47. protected virtual string grant_failed_message { get; }
  48. protected virtual string permission_granted_message { get; }
  49. protected virtual string permission_required_message { get; }
  50. protected virtual string user_required_message { get; }
  51. }
  52. [CCode (cheader_filename = "spry-0.2.h")]
  53. public class LoginAction : Statum.StatumAction {
  54. public LoginAction ();
  55. public override async Statum.DirectiveBuilder handle () throws GLib.Error;
  56. protected virtual string invalid_credentials_message { get; }
  57. protected virtual string landing_uri { get; }
  58. }
  59. [CCode (cheader_filename = "spry-0.2.h")]
  60. public class LogoutAction : Statum.StatumAction {
  61. public LogoutAction ();
  62. public override async Statum.DirectiveBuilder handle () throws GLib.Error;
  63. protected virtual string logged_out_uri { get; }
  64. }
  65. [CCode (cheader_filename = "spry-0.2.h")]
  66. public class ProfileValidation : GLib.Object {
  67. public class Fields : GLib.Object {
  68. public GLib.DateTime date_of_birth { get; private set; }
  69. public string email { get; private set; }
  70. public string forename { get; private set; }
  71. public string surname { get; private set; }
  72. public string username { get; private set; }
  73. }
  74. public enum Rejection {
  75. USERNAME_TOO_SHORT,
  76. INVALID_EMAIL,
  77. NAME_REQUIRED,
  78. DATE_OF_BIRTH_REQUIRED,
  79. INVALID_DATE_OF_BIRTH
  80. }
  81. public ProfileValidation ();
  82. public static string? duplicate_message (GLib.Error e, string username_message, string email_message, string other_message);
  83. public static Spry.Actions.ProfileValidation.Fields? validate (Statum.StatumRequest request, out Spry.Actions.ProfileValidation.Rejection rejection);
  84. }
  85. [CCode (cheader_filename = "spry-0.2.h")]
  86. public class RegisterAction : Statum.StatumAction {
  87. public RegisterAction ();
  88. public override async Statum.DirectiveBuilder handle () throws GLib.Error;
  89. protected virtual string account_created_message { get; }
  90. protected virtual string date_of_birth_required_message { get; }
  91. protected virtual string duplicate_email_message { get; }
  92. protected virtual string duplicate_user_message { get; }
  93. protected virtual string duplicate_username_message { get; }
  94. protected virtual string invalid_date_of_birth_message { get; }
  95. protected virtual string invalid_email_message { get; }
  96. protected virtual string login_uri { get; }
  97. protected virtual string name_required_message { get; }
  98. protected virtual string password_mismatch_message { get; }
  99. protected virtual string password_too_short_message { get; }
  100. protected virtual string registration_failed_message { get; }
  101. protected virtual string username_too_short_message { get; }
  102. }
  103. [CCode (cheader_filename = "spry-0.2.h")]
  104. public class RevokePermissionAction : Spry.Actions.UserManagementAction {
  105. public RevokePermissionAction ();
  106. public override async Statum.DirectiveBuilder handle () throws GLib.Error;
  107. protected virtual string permission_required_message { get; }
  108. protected virtual string permission_revoked_message { get; }
  109. protected virtual string revoke_failed_message { get; }
  110. protected virtual string user_required_message { get; }
  111. }
  112. [CCode (cheader_filename = "spry-0.2.h")]
  113. public class SetUserEnabledAction : Spry.Actions.UserManagementAction {
  114. public SetUserEnabledAction ();
  115. public override async Statum.DirectiveBuilder handle () throws GLib.Error;
  116. protected virtual string update_failed_message { get; }
  117. protected virtual string user_disabled_message { get; }
  118. protected virtual string user_enabled_message { get; }
  119. protected virtual string user_required_message { get; }
  120. }
  121. [CCode (cheader_filename = "spry-0.2.h")]
  122. public class UserActionPrivate : GLib.Object {
  123. public UserActionPrivate ();
  124. public int64 user_id { get; set; }
  125. }
  126. [CCode (cheader_filename = "spry-0.2.h")]
  127. public abstract class UserManagementAction : Statum.StatumAction {
  128. protected Spry.Authentication.UserService users;
  129. protected UserManagementAction ();
  130. protected async Statum.DirectiveBuilder? require_permission_guard ();
  131. protected string target_permission ();
  132. protected int64 target_user_id ();
  133. protected override string private_namespace { get; }
  134. protected virtual string required_permission { get; }
  135. protected virtual string unauthorised_uri { get; }
  136. }
  137. }
  138. namespace Authentication {
  139. namespace Migrations {
  140. [CCode (cheader_filename = "spry-0.2.h")]
  141. public class M0001_Initial : InvercargillSql.Migrations.Migration {
  142. public M0001_Initial ();
  143. public override void down (InvercargillSql.Migrations.MigrationBuilder b);
  144. public override void up (InvercargillSql.Migrations.MigrationBuilder b);
  145. public override string migration_namespace { get; }
  146. public override string name { get; }
  147. public override uint64 serial { get; }
  148. }
  149. }
  150. [CCode (cheader_filename = "spry-0.2.h")]
  151. public class UserEntity : GLib.Object {
  152. public UserEntity ();
  153. public static void entity_mapping (InvercargillSql.Orm.EntityMapperBuilder<Spry.Authentication.UserEntity> cfg);
  154. public GLib.DateTime created { get; set; }
  155. public GLib.DateTime date_of_birth { get; set; }
  156. public string email { get; set; }
  157. public bool enabled { get; set; }
  158. public string forename { get; set; }
  159. public int64 id { get; set; }
  160. public GLib.DateTime modified { get; set; }
  161. public string password_hash { get; set; }
  162. public string surname { get; set; }
  163. public string username { get; set; }
  164. }
  165. [CCode (cheader_filename = "spry-0.2.h")]
  166. public class UserPermissionEntity : GLib.Object {
  167. public UserPermissionEntity ();
  168. public static void entity_mapping (InvercargillSql.Orm.EntityMapperBuilder<Spry.Authentication.UserPermissionEntity> cfg);
  169. public int64 id { get; set; }
  170. public string permission { get; set; }
  171. public int64 user_id { get; set; }
  172. }
  173. [CCode (cheader_filename = "spry-0.2.h")]
  174. public class UserProjection : GLib.Object {
  175. public UserProjection ();
  176. public static void projection_mapping (InvercargillSql.Orm.Projections.ProjectionBuilder<Spry.Authentication.UserProjection> cfg) throws GLib.Error;
  177. public GLib.DateTime created { get; set; }
  178. public GLib.DateTime date_of_birth { get; set; }
  179. public string email { get; set; }
  180. public bool enabled { get; set; }
  181. public string forename { get; set; }
  182. public int64 id { get; set; }
  183. public GLib.DateTime modified { get; set; }
  184. public string password_hash { get; set; }
  185. public Invercargill.ImmutableLot<string> permissions { owned get; }
  186. public string surname { get; set; }
  187. public string username { get; }
  188. }
  189. [CCode (cheader_filename = "spry-0.2.h")]
  190. public class UserService : GLib.Object {
  191. public UserService ();
  192. public async Spry.Authentication.UserEntity alter_user (int64 user_id, string username, string email, string forename, string surname, GLib.DateTime date_of_birth, bool enabled) throws GLib.Error;
  193. public async Spry.Authentication.UserProjection? authenticate_user (string username, string password) throws GLib.Error;
  194. public async void clear_user_permissions (int64 user_id) throws GLib.Error;
  195. public async void delete_user (int64 user_id) throws GLib.Error;
  196. public async Spry.Authentication.UserProjection? get_user (int64 user_id) throws GLib.Error;
  197. public async Spry.Authentication.UserProjection? get_user_by_username (string username) throws GLib.Error;
  198. public async Invercargill.ImmutableLot<string> get_user_permissions (int64 user_id) throws GLib.Error;
  199. public async Invercargill.ImmutableLot<Spry.Authentication.UserProjection> list_users (int64 offset = 0, int64 limit = 100) throws GLib.Error;
  200. public async Spry.Authentication.UserEntity register_user (string username, string email, string forename, string surname, GLib.DateTime date_of_birth, string password, bool enabled = true) throws GLib.Error;
  201. public async void remove_user_permission (int64 user_id, string permission) throws GLib.Error;
  202. public async void set_password (int64 user_id, string password) throws GLib.Error;
  203. public async void set_user_enabled (int64 user_id, bool enabled) throws GLib.Error;
  204. public async void set_user_permission (int64 user_id, string permission) throws GLib.Error;
  205. }
  206. [CCode (cheader_filename = "spry-0.2.h")]
  207. public errordomain UserServiceError {
  208. USER_NOT_FOUND
  209. }
  210. }
  211. [CCode (cheader_filename = "spry-0.2.h")]
  212. public class AuthPrivate : GLib.Object {
  213. public AuthPrivate ();
  214. public int64 user_id { get; set; }
  215. }
  216. [CCode (cheader_filename = "spry-0.2.h")]
  217. public class AuthPublic : GLib.Object {
  218. public AuthPublic ();
  219. public string display_name { get; set; }
  220. public Statum.Model.ActionDto? logout { get; set; }
  221. public string[] permissions { get; set; }
  222. public string username { get; set; }
  223. }
  224. [CCode (cheader_filename = "spry-0.2.h")]
  225. public class CurrentUser : GLib.Object {
  226. public CurrentUser ();
  227. public CurrentUser.authenticated (int64 user_id, string username, string display_name, string[] permissions);
  228. public bool has_permission (string permission);
  229. public string display_name { get; private set; }
  230. public bool is_anonymous { get; private set; }
  231. public string[] permissions { get; private set; }
  232. public int64 user_id { get; private set; }
  233. public string username { get; private set; }
  234. }
  235. [CCode (cheader_filename = "spry-0.2.h")]
  236. public class SpryAuth : GLib.Object {
  237. public const string ADMIN_PERMISSION;
  238. public const string SLOT_TYPE;
  239. public SpryAuth ();
  240. public static Spry.CurrentUser current (Statum.StatumRequest request);
  241. public static async void ensure_admin (Spry.Authentication.UserService users, string username, string email, string password) throws GLib.Error;
  242. public static Statum.DirectiveBuilder login (Statum.DirectiveBuilder directives, Spry.Authentication.UserProjection user, Statum.ActionRegistry action_registry) throws GLib.Error;
  243. public static bool permission_matches (string[] patterns, string permission);
  244. public static void register_actions (Statum.StatumConfigurator cfg);
  245. public static async Statum.DirectiveBuilder? require_login (Statum.DirectiveBuilder directives, Statum.StatumRequest request, Spry.Authentication.UserService users, string redirect = "/login");
  246. public static async Statum.DirectiveBuilder? require_permission (Statum.DirectiveBuilder directives, Statum.StatumRequest request, Spry.Authentication.UserService users, string permission, string redirect = "/login");
  247. }
  248. [CCode (cheader_filename = "spry-0.2.h")]
  249. public class SpryModule : GLib.Object, Inversion.Module {
  250. public SpryModule ();
  251. }
  252. }