//allows to check and process the addition and editing of user's objects public override bool CheckAndProcess(CheckAndProcessArgs <User> args) { //var db = args.Database as RealmiusServerContext; if (args.Entity is NoteRealm) { //if the first upload of the object if (args.OriginalDbEntity == null) { var newNote = args.Entity as NoteRealm; newNote.UserRole = args.User.Role; return(true); } //otherwise check user's rights to edit the object if (args.User.Role >= (args.OriginalDbEntity as NoteRealm).UserRole) { return(true); } } if (args.Entity is PhotoRealm) { //photos are editable by everyone return(true); } if (args.Entity is ChatMessageRealm) { //chat messages are not editable at all if (args.OriginalDbEntity != null) { return(false); } return(true); } return(false); }
public override bool CheckAndProcess(CheckAndProcessArgs <object> args) { return(true); }
public override bool CheckAndProcess(CheckAndProcessArgs <LimitedUser> args) { return(true); }