Guest User

Untitled

a guest
Jun 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. z = r[:priv]
  2. privileges = {}
  3. 15.downto(0) {
  4. |i|
  5. if(z >= 2 ^ i)
  6. privileges[i+1] = 1
  7. z = z - 2 ^ i
  8. else
  9. privileges[i+1] = 0
  10. }
  11.  
  12. privileges.each {
  13. |key, value|
  14. if value == 1
  15. users_institutions_privileges << {
  16. :user_id => r[:id],
  17. :institution_id => r[:pio_institution],
  18. :privilege_id => key,
  19. :sync_status => r[:sync_status]
  20. }
  21. end
  22. }
Add Comment
Please, Sign In to add comment