@@ -33,7 +33,7 @@ pub fn rule_is_creator(ctx: &RuleContext) -> Result<(), RuleError> {
3333pub fn rule_host_can_invite ( ctx : & RuleContext ) -> Result < ( ) , RuleError > {
3434 let connection = ctx. pool . get ( ) . map_err ( |_| RuleError :: PoolError ) ?;
3535 match internal:: member:: role_for ( & connection, ctx. host_uuid , ctx. group ) {
36- Ok ( role)
36+ Ok ( Some ( role) )
3737 if role. typ == RoleType :: Admin
3838 || role. permissions . contains ( & PermissionType :: InviteMember ) =>
3939 {
@@ -48,7 +48,7 @@ pub fn rule_host_can_invite(ctx: &RuleContext) -> Result<(), RuleError> {
4848pub fn rule_host_can_remove ( ctx : & RuleContext ) -> Result < ( ) , RuleError > {
4949 let connection = ctx. pool . get ( ) . map_err ( |_| RuleError :: PoolError ) ?;
5050 match internal:: member:: role_for ( & connection, ctx. host_uuid , ctx. group ) {
51- Ok ( role)
51+ Ok ( Some ( role) )
5252 if role. typ == RoleType :: Admin
5353 || role. permissions . contains ( & PermissionType :: RemoveMember ) =>
5454 {
@@ -115,7 +115,7 @@ pub fn current_user_can_join(ctx: &RuleContext) -> Result<(), RuleError> {
115115pub fn rule_host_is_curator ( ctx : & RuleContext ) -> Result < ( ) , RuleError > {
116116 let connection = ctx. pool . get ( ) . map_err ( |_| RuleError :: PoolError ) ?;
117117 match internal:: member:: role_for ( & connection, ctx. host_uuid , ctx. group ) {
118- Ok ( role) if role. typ == RoleType :: Admin || role. typ == RoleType :: Curator => Ok ( ( ) ) ,
118+ Ok ( Some ( role) ) if role. typ == RoleType :: Admin || role. typ == RoleType :: Curator => Ok ( ( ) ) ,
119119 _ => Err ( RuleError :: NotACurator ) ,
120120 }
121121}
@@ -124,7 +124,7 @@ pub fn rule_host_is_curator(ctx: &RuleContext) -> Result<(), RuleError> {
124124pub fn rule_host_is_group_admin ( ctx : & RuleContext ) -> Result < ( ) , RuleError > {
125125 let connection = ctx. pool . get ( ) . map_err ( |_| RuleError :: PoolError ) ?;
126126 match internal:: member:: role_for ( & connection, ctx. host_uuid , ctx. group ) {
127- Ok ( role) if role. typ == RoleType :: Admin => Ok ( ( ) ) ,
127+ Ok ( Some ( role) ) if role. typ == RoleType :: Admin => Ok ( ( ) ) ,
128128 _ => Err ( RuleError :: NotAnAdmin ) ,
129129 }
130130}
@@ -134,7 +134,7 @@ pub fn rule_user_has_member_role(ctx: &RuleContext) -> Result<(), RuleError> {
134134 let member_uuid = ctx. member_uuid . ok_or ( RuleError :: InvalidRuleContext ) ?;
135135 let connection = ctx. pool . get ( ) . map_err ( |_| RuleError :: PoolError ) ?;
136136 match internal:: member:: role_for ( & connection, member_uuid, ctx. group ) {
137- Ok ( role) if role. typ == RoleType :: Member => Ok ( ( ) ) ,
137+ Ok ( Some ( role) ) if role. typ == RoleType :: Member => Ok ( ( ) ) ,
138138 _ => Err ( RuleError :: NotAnAdmin ) ,
139139 }
140140}
@@ -144,7 +144,7 @@ pub fn rule_user_has_member_role(ctx: &RuleContext) -> Result<(), RuleError> {
144144pub fn rule_host_can_edit_terms ( ctx : & RuleContext ) -> Result < ( ) , RuleError > {
145145 let connection = ctx. pool . get ( ) . map_err ( |_| RuleError :: PoolError ) ?;
146146 match internal:: member:: role_for ( & connection, ctx. host_uuid , ctx. group ) {
147- Ok ( role)
147+ Ok ( Some ( role) )
148148 if role. typ == RoleType :: Admin
149149 || role. permissions . contains ( & PermissionType :: EditTerms ) =>
150150 {
0 commit comments