fastauth_plugin_admin/
error.rs1use fastauth_core::plugin_prelude::*;
4
5#[derive(AuthError, Clone, Debug, PartialEq, Eq)]
9pub enum AdminError {
10 #[auth_error(status = 400, message = "You cannot ban yourself")]
11 YouCannotBanYourself,
12 #[auth_error(status = 403, message = "You are not allowed to change users role")]
13 YouAreNotAllowedToChangeUsersRole,
14 #[auth_error(status = 403, message = "You are not allowed to create users")]
15 YouAreNotAllowedToCreateUsers,
16 #[auth_error(status = 403, message = "You are not allowed to list users")]
17 YouAreNotAllowedToListUsers,
18 #[auth_error(status = 403, message = "You are not allowed to list users sessions")]
19 YouAreNotAllowedToListUsersSessions,
20 #[auth_error(status = 403, message = "You are not allowed to ban users")]
21 YouAreNotAllowedToBanUsers,
22 #[auth_error(status = 403, message = "You are not allowed to impersonate users")]
23 YouAreNotAllowedToImpersonateUsers,
24 #[auth_error(status = 403, message = "You are not allowed to revoke users sessions")]
25 YouAreNotAllowedToRevokeUsersSessions,
26 #[auth_error(status = 403, message = "You are not allowed to delete users")]
27 YouAreNotAllowedToDeleteUsers,
28 #[auth_error(status = 403, message = "You are not allowed to set users password")]
29 YouAreNotAllowedToSetUsersPassword,
30 #[auth_error(status = 403, message = "{message}")]
33 BannedUser { message: String },
34 #[auth_error(status = 403, message = "You are not allowed to get user")]
35 YouAreNotAllowedToGetUser,
36 #[auth_error(status = 400, message = "No data to update")]
37 NoDataToUpdate,
38 #[auth_error(status = 403, message = "You are not allowed to update users")]
39 YouAreNotAllowedToUpdateUsers,
40 #[auth_error(status = 400, message = "You cannot remove yourself")]
41 YouCannotRemoveYourself,
42 #[auth_error(
43 status = 400,
44 message = "You are not allowed to set a non-existent role value"
45 )]
46 YouAreNotAllowedToSetNonExistentValue,
47 #[auth_error(status = 403, message = "You cannot impersonate admins")]
48 YouCannotImpersonateAdmins,
49 #[auth_error(status = 400, message = "Invalid role type")]
50 InvalidRoleType,
51 #[auth_error(status = 403, message = "You are not allowed to update users email")]
52 YouAreNotAllowedToSetUsersEmail,
53 #[auth_error(
54 status = 400,
55 message = "Password cannot be updated through update-user. Use the set-user-password endpoint instead"
56 )]
57 PasswordCannotBeUpdatedViaUpdateUser,
58 #[auth_error(status = 400, message = "User id cannot be updated")]
59 UserIdCannotBeUpdated,
60 #[auth_error(status = 400, message = "You are not impersonating anyone")]
62 NotImpersonating,
63}