refactoring code
This commit is contained in:
committed by
Daniel Hutzel
parent
ecdc32bad1
commit
e08b1c6246
@@ -1,35 +1,19 @@
|
||||
using {sap.capire.media.store as my} from '../db/schema';
|
||||
|
||||
service Users {
|
||||
// redundant entity
|
||||
// We need actions without exposing entity for now.
|
||||
// But we forced to expose for make actions work.
|
||||
entity Customers @(restrict : [{
|
||||
grant : [
|
||||
'READ',
|
||||
'WRITE'
|
||||
],
|
||||
to : 'employee'
|
||||
}, ]) as projection on my.Customers;
|
||||
/**
|
||||
* Below entities also restricted programmatically. Only User
|
||||
* can only access to yours record
|
||||
*/
|
||||
entity Customers as projection on my.Customers excluding {
|
||||
password,
|
||||
supportRep
|
||||
};
|
||||
|
||||
type Person {
|
||||
lastName : String(20);
|
||||
firstName : String(40);
|
||||
city : String(40);
|
||||
state : String(40);
|
||||
address : String(70);
|
||||
country : String(40);
|
||||
postalCode : String(10);
|
||||
phone : String(24);
|
||||
fax : String(24);
|
||||
email : String(60);
|
||||
}
|
||||
|
||||
@(requires : 'authenticated-user')
|
||||
action updatePerson(person : Person);
|
||||
|
||||
@(requires : 'authenticated-user')
|
||||
function getPerson() returns Person;
|
||||
entity Employees as projection on my.Customers excluding {
|
||||
password,
|
||||
supportRep
|
||||
};
|
||||
|
||||
action login(email : String(111), password : String(200)) returns {
|
||||
roles : array of String(111);
|
||||
@@ -38,3 +22,19 @@ service Users {
|
||||
ID : Integer;
|
||||
};
|
||||
}
|
||||
|
||||
annotate Users.Customers with @(restrict : [{
|
||||
grant : [
|
||||
'READ',
|
||||
'UPDATE'
|
||||
],
|
||||
to : 'customer'
|
||||
}]);
|
||||
|
||||
annotate Users.Employees with @(restrict : [{
|
||||
grant : [
|
||||
'READ',
|
||||
'UPDATE'
|
||||
],
|
||||
to : 'employee'
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user