mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
Refactor user to admin and api user
This commit is contained in:
parent
f3215680d5
commit
037cb57e00
34 changed files with 551 additions and 551 deletions
|
@ -4,7 +4,7 @@ class Ability
|
|||
def initialize(user)
|
||||
alias_action :create, :read, :update, :destroy, to: :crud
|
||||
|
||||
@user = user || User.new
|
||||
@user = user || AdminUser.new
|
||||
@user.roles.each { |role| send(role) } if @user.roles
|
||||
|
||||
return if @user.roles || @user.roles.any?
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class AdminUser < User
|
||||
devise :trackable, :timeoutable
|
||||
# TODO: Foreign user will get email with activation link,email,temp-password.
|
||||
# After activisation, system should require to change temp password.
|
||||
# TODO: Estonian id validation
|
||||
|
|
|
@ -30,7 +30,7 @@ module Versions
|
|||
if creator_str =~ /^\d-api-/
|
||||
ApiUser.find(creator_str)
|
||||
else
|
||||
User.find(creator_str)
|
||||
AdminUser.find(creator_str)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -40,7 +40,7 @@ module Versions
|
|||
if updator_str =~ /^\d-api-/
|
||||
ApiUser.find(updator_str)
|
||||
else
|
||||
User.find(updator_str)
|
||||
AdminUser.find(updator_str)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
class User < ActiveRecord::Base
|
||||
include Versions # version/user_version.rb
|
||||
devise :trackable, :timeoutable
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue