File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ async fn post_inner(
6666 } ;
6767
6868 // If a project is unclaimed, don't check permissions
69- if ! query_project. is_unclaimed ( conn_lock ! ( context) ) ? {
69+ if query_project. is_claimed ( conn_lock ! ( context) ) ? {
7070 if let Some ( auth_user) = auth_user. as_ref ( ) {
7171 query_project. try_allowed ( & context. rbac , auth_user, Permission :: Create ) ?;
7272 } else {
Original file line number Diff line number Diff line change @@ -91,14 +91,14 @@ impl QueryOrganization {
9191 if let Ok ( query_organization) =
9292 Self :: from_resource_id ( conn_lock ! ( context) , & project_slug. clone ( ) . into ( ) )
9393 {
94- // If the project is part of an organization that is unclaimed,
95- // then the project can have anonymous reports.
96- return if query_organization. is_unclaimed ( conn_lock ! ( context) ) ? {
97- Ok ( query_organization)
98- } else {
94+ // If the project is part of an organization that is claimed,
95+ // then the project can not have anonymous reports.
96+ return if query_organization. is_claimed ( conn_lock ! ( context) ) ? {
9997 Err ( unauthorized_error ( format ! (
10098 "This project ({project_slug}) has already been claimed."
10199 ) ) )
100+ } else {
101+ Ok ( query_organization)
102102 } ;
103103 }
104104
@@ -224,10 +224,10 @@ impl QueryOrganization {
224224 . map_err ( forbidden_error)
225225 }
226226
227- pub fn is_unclaimed ( & self , conn : & mut DbConnection ) -> Result < bool , HttpError > {
227+ pub fn is_claimed ( & self , conn : & mut DbConnection ) -> Result < bool , HttpError > {
228228 let total_members = QueryOrganizationRole :: count ( conn, self . id ) ?;
229229 // If the organization that has zero members, then it is unclaimed.
230- Ok ( total_members == 0 )
230+ Ok ( total_members > 0 )
231231 }
232232
233233 pub fn into_json ( self ) -> JsonOrganization {
Original file line number Diff line number Diff line change @@ -386,9 +386,9 @@ impl QueryProject {
386386 . map_err ( forbidden_error)
387387 }
388388
389- pub fn is_unclaimed ( & self , conn : & mut DbConnection ) -> Result < bool , HttpError > {
389+ pub fn is_claimed ( & self , conn : & mut DbConnection ) -> Result < bool , HttpError > {
390390 let query_organization = QueryOrganization :: get ( conn, self . organization_id ) ?;
391- query_organization. is_unclaimed ( conn)
391+ query_organization. is_claimed ( conn)
392392 }
393393
394394 #[ cfg( feature = "plus" ) ]
You can’t perform that action at this time.
0 commit comments