Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- z = r[:priv]
- privileges = {}
- 15.downto(0) {
- |i|
- if(z >= 2 ^ i)
- privileges[i+1] = 1
- z = z - 2 ^ i
- else
- privileges[i+1] = 0
- }
- privileges.each {
- |key, value|
- if value == 1
- users_institutions_privileges << {
- :user_id => r[:id],
- :institution_id => r[:pio_institution],
- :privilege_id => key,
- :sync_status => r[:sync_status]
- }
- end
- }
Add Comment
Please, Sign In to add comment