public void removPermission(Permission permission) { if (this.Permissions != null && this.Permissions.Contains(permission)) { this.Permissions.Remove(permission); permission.removUser(this); } }
public void addPermission(Permission permission) { if (this.Permissions == null) { this.Permissions = new List<Permission>(); } this.Permissions.Add(permission); permission.addUser(this); }
// POST: odata/Permissions public IHttpActionResult Post( Permission permission ) { if ( !ModelState.IsValid ) { return BadRequest( ModelState ); } db.PermissionSet.Add( permission ); db.SaveChanges(); return Created( permission ); }
private static Permission generatePermisson( ModelContext context, string name, bool state ) { try { Permission permission = new Permission() { Name = name, Credential = generateCredantial( context, state ), Task = generateTask( name ) }; context.PermissionSet.AddOrUpdate( p => p.Name, permission ); Log.DebugFormat( $"generatePermisson: {permission.toString()}\nDONE" ); return permission; } catch ( Exception e ) { Log.Error( "generatePermisson", e ); return null; } }
public IUser(Permission permission) : base() { this.addPermission(permission); }