ruby on rails - Query ActiveRecord with file permission type mathematical formula -
so standard file permissions written in 0 7:
7 = 4+2+1 (read/write/execute) 6 = 4+2 (read/write) 5 = 4+1 (read/execute) 4 = 4 (read) 3 = 2+1 (write/execute) 2 = 2 (write) 1 = 1 (execute)
so lets want save permissions on record same way. how place query/scope on records permit "read" permissions.
for example 4 == :record_permission % (4+1)
should return readable permission records.
Comments
Post a Comment