From: Pedro Gonzalez Gomez Date: Fri, 22 Mar 2024 14:20:48 +0000 (+0100) Subject: mgr/dashboard: add system users to rgw user form X-Git-Tag: v19.1.0~182^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F56473%2Fhead;p=ceph.git mgr/dashboard: add system users to rgw user form Fixes: https://tracker.ceph.com/issues/65074 Signed-off-by: Pedro Gonzalez Gomez (cherry picked from commit b658bb9c32ad31608921e77603003c004ab0f15b) --- diff --git a/src/pybind/mgr/dashboard/controllers/rgw.py b/src/pybind/mgr/dashboard/controllers/rgw.py index 1b3b9ef866e9..ddda3369f47a 100644 --- a/src/pybind/mgr/dashboard/controllers/rgw.py +++ b/src/pybind/mgr/dashboard/controllers/rgw.py @@ -595,7 +595,7 @@ class RgwUser(RgwRESTController): @allow_empty_body def create(self, uid, display_name, email=None, max_buckets=None, - suspended=None, generate_key=None, access_key=None, + system=None, suspended=None, generate_key=None, access_key=None, secret_key=None, daemon_name=None): params = {'uid': uid} if display_name is not None: @@ -604,6 +604,8 @@ class RgwUser(RgwRESTController): params['email'] = email if max_buckets is not None: params['max-buckets'] = max_buckets + if system is not None: + params['system'] = system if suspended is not None: params['suspended'] = suspended if generate_key is not None: @@ -617,7 +619,7 @@ class RgwUser(RgwRESTController): @allow_empty_body def set(self, uid, display_name=None, email=None, max_buckets=None, - suspended=None, daemon_name=None): + system=None, suspended=None, daemon_name=None): params = {'uid': uid} if display_name is not None: params['display-name'] = display_name @@ -625,6 +627,8 @@ class RgwUser(RgwRESTController): params['email'] = email if max_buckets is not None: params['max-buckets'] = max_buckets + if system is not None: + params['system'] = system if suspended is not None: params['suspended'] = suspended result = self.proxy(daemon_name, 'POST', 'user', params) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.html index 27162404a62b..49aff08e3875 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.html @@ -60,8 +60,8 @@ System - {{ user.system === 'true' | booleanText }} + class="bold">System user + {{ user.system | booleanText }} { }); it('should show correct "System" info', () => { - component.selection = { uid: '', email: '', system: 'true', keys: [], swift_keys: [] }; + component.selection = { uid: '', email: '', system: true, keys: [], swift_keys: [] }; component.ngOnChanges(); fixture.detectChanges(); @@ -37,10 +37,10 @@ describe('RgwUserDetailsComponent', () => { const detailsTab = fixture.debugElement.nativeElement.querySelectorAll( '.table.table-striped.table-bordered tr td' ); - expect(detailsTab[10].textContent).toEqual('System'); + expect(detailsTab[10].textContent).toEqual('System user'); expect(detailsTab[11].textContent).toEqual('Yes'); - component.selection.system = 'false'; + component.selection.system = false; component.ngOnChanges(); fixture.detectChanges(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html index 9fec45dfe01a..69e9b4ca29ba 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html @@ -164,6 +164,22 @@ + +
+
+
+ + + System users are distinct from regular users, they are used by the RGW service to perform administrative tasks, manage buckets and objects +
+
+
+
S3 key diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts index 15665d53bb95..64afa205e692 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts @@ -187,6 +187,7 @@ describe('RgwUserFormComponent', () => { max_buckets: -1, secret_key: '', suspended: false, + system: false, uid: null }); }); @@ -200,7 +201,8 @@ describe('RgwUserFormComponent', () => { display_name: null, email: null, max_buckets: -1, - suspended: false + suspended: false, + system: false }); }); @@ -216,6 +218,7 @@ describe('RgwUserFormComponent', () => { max_buckets: 0, secret_key: '', suspended: false, + system: false, uid: null }); }); @@ -229,7 +232,8 @@ describe('RgwUserFormComponent', () => { display_name: null, email: null, max_buckets: 0, - suspended: false + suspended: false, + system: false }); }); @@ -246,6 +250,7 @@ describe('RgwUserFormComponent', () => { max_buckets: 100, secret_key: '', suspended: false, + system: false, uid: null }); }); @@ -260,7 +265,8 @@ describe('RgwUserFormComponent', () => { display_name: null, email: null, max_buckets: 100, - suspended: false + suspended: false, + system: false }); }); }); @@ -283,7 +289,8 @@ describe('RgwUserFormComponent', () => { display_name: null, email: '', max_buckets: 1000, - suspended: false + suspended: false, + system: false }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts index 9d4e1ce601b7..b2cb7d6518d9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts @@ -109,6 +109,7 @@ export class RgwUserFormComponent extends CdForm implements OnInit { 1000, [CdValidators.requiredIf({ max_buckets_mode: '1' }), CdValidators.number(false)] ], + system: [false], suspended: [false], // S3 key generate_key: [true], @@ -577,7 +578,7 @@ export class RgwUserFormComponent extends CdForm implements OnInit { * @return {Boolean} Returns TRUE if the general user settings have been modified. */ private _isGeneralDirty(): boolean { - return ['display_name', 'email', 'max_buckets_mode', 'max_buckets', 'suspended'].some( + return ['display_name', 'email', 'max_buckets_mode', 'max_buckets', 'system', 'suspended'].some( (path) => { return this.userForm.get(path).dirty; } @@ -624,6 +625,7 @@ export class RgwUserFormComponent extends CdForm implements OnInit { const result = { uid: this.getUID(), display_name: this.userForm.getValue('display_name'), + system: this.userForm.getValue('system'), suspended: this.userForm.getValue('suspended'), email: '', max_buckets: this.userForm.getValue('max_buckets'), @@ -658,7 +660,7 @@ export class RgwUserFormComponent extends CdForm implements OnInit { */ private _getUpdateArgs() { const result: Record = {}; - const keys = ['display_name', 'email', 'max_buckets', 'suspended']; + const keys = ['display_name', 'email', 'max_buckets', 'system', 'suspended']; for (const key of keys) { result[key] = this.userForm.getValue(key); } diff --git a/src/pybind/mgr/dashboard/openapi.yaml b/src/pybind/mgr/dashboard/openapi.yaml index 711e8c8e9557..606b6c13a8ed 100644 --- a/src/pybind/mgr/dashboard/openapi.yaml +++ b/src/pybind/mgr/dashboard/openapi.yaml @@ -10980,6 +10980,8 @@ paths: type: string suspended: type: string + system: + type: string uid: type: string required: @@ -11132,6 +11134,8 @@ paths: type: string suspended: type: string + system: + type: string type: object responses: '200':