WIP: Permissions
0/10 threads resolved
changed milestone to %Permission #review
added Sprint::09/25 - Oldfashioned Owl Squad::Green scoped labels
added MR::Requires Changes Product::Security scoped labels
370 370 371 371 this.selectOption('share'); 372 372 } 373 374 checkEditPermissions() { - Owner
boolean return type
370 370 371 371 this.selectOption('share'); 372 372 } 373 374 checkEditPermissions() { 375 if (this.featuresService.has('permissions')) { 376 return this.permissionsService.canInteract(this.entity, Flags.EDIT_POST); 377 } 378 379 return ( 380 this.entity.owner_guid == this.session.getLoggedInUser().guid || 381 this.session.isAdmin() 382 ); 383 } 384 385 checkDeletePermissions() { - Owner
return type
43 private modal: SignupModalService 47 private modal: SignupModalService, 48 private permissionsService: PermissionsService, 49 private featuresService: FeaturesService 44 50 ) {} 45 51 46 set _object(value: any) { 52 @Input('object') set _object(value: any) { 47 53 this.object = value; 48 54 if (!this.object['thumbs:down:user_guids']) 49 55 this.object['thumbs:down:user_guids'] = []; 56 57 this.checkPermissions(); 58 } 59 60 private checkPermissions() { - Owner
return type?
52 private permissionsService: PermissionsService, 53 private featuresService: FeaturesService, 48 54 private cd: ChangeDetectorRef 49 55 ) {} 50 56 51 set _object(value: any) { 57 @Input('object') set _object(value: any) { 52 58 if (!value) return; 53 59 this.object = value; 54 60 if (!this.object['thumbs:up:user_guids']) 55 61 this.object['thumbs:up:user_guids'] = []; 62 63 this.checkPermissions(); 64 } 65 66 private checkPermissions() { - Owner
return type void
1 export enum Flags { - Owner
What is our plan for keeping this in sync with backend?
1 import { Flags } from './flags'; 2 3 export type Permissions = { 4 name: string; 5 permissions: string[]; 6 }; 7 8 export class PermissionsService { 9 canInteract(entity: any, permission: Flags) { - Owner
return type
380 383 }) 381 384 .present(); 382 385 } 386 387 checkEditPermissions() { - Owner
return type boolean
387 checkEditPermissions() { 388 if (this.featuresService.has('permissions')) { 389 return this.permissionsService.canInteract( 390 this.comment, 391 Flags.EDIT_COMMENT 392 ); 393 } 394 395 return ( 396 this.comment.owner_guid == this.session.getLoggedInUser().guid || 397 this.session.isAdmin() || 398 this.canEdit 399 ); 400 } 401 402 checkDeletePermissions() { - Owner
return type boolean
146 146 "environment" => getenv('MINDS_ENV') ?: 'development', 147 147 ]; 148 148 149 if(Minds\Core\Session::isLoggedIn()){ 150 $minds['user'] = Minds\Core\Session::getLoggedinUser()->export(); 151 $minds['user']['rewards'] = !!Minds\Core\Session::getLoggedinUser()->getPhoneNumberHash(); 152 $minds['wallet'] = array('balance' => Minds\Helpers\Counters::get(Minds\Core\Session::getLoggedinUser()->guid, 'points', false)); 149 if (Minds\Core\Session::isLoggedIn()) { 150 $user = Minds\Core\Session::getLoggedinUser(); - Owner
php still needs 4 spaces
146 146 "environment" => getenv('MINDS_ENV') ?: 'development', 147 147 ]; 148 148 149 if(Minds\Core\Session::isLoggedIn()){ 150 $minds['user'] = Minds\Core\Session::getLoggedinUser()->export(); 151 $minds['user']['rewards'] = !!Minds\Core\Session::getLoggedinUser()->getPhoneNumberHash(); 152 $minds['wallet'] = array('balance' => Minds\Helpers\Counters::get(Minds\Core\Session::getLoggedinUser()->guid, 'points', false)); 149 if (Minds\Core\Session::isLoggedIn()) { 150 $user = Minds\Core\Session::getLoggedinUser(); 151 $minds['user'] = $user->export(); 152 $minds['user']['rewards'] = !!Minds\Core\Session::getLoggedinUser()->getPhoneNumberHash(); 153 $minds['wallet'] = array('balance' => Minds\Helpers\Counters::get(Minds\Core\Session::getLoggedinUser()->guid, 'points', false)); 154 155 if(Minds\Core\Di\Di::_()->get('Features\Manager')->has('permissions')) { - Owner
spacing. Also I'm not sure if window is the correct place for this. Especially with forward planning the SSR work