-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We add group and group_membership so we could authorize an individual…
… by group. Oh, btw, group factory buggy because no auto-increment on primary key, factory returns nil but doesn't complain, nasty bug hunt, so we do it manually! Ask Noah about ROM and Sequal stuff.
- Loading branch information
1 parent
031eff3
commit 61adc8a
Showing
12 changed files
with
132 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Lauth | ||
class Group < ROM::Struct | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
lauth/lib/lauth/persistence/relations/group_memberships.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Lauth | ||
module Persistence | ||
module Relations | ||
class GroupMemberships < ROM::Relation[:sql] | ||
schema(:aa_is_member_of_grp, infer: true, as: :group_memberships) do | ||
# attribute :lastModifiedTime, Types::Time.default { Time.now } | ||
attribute :lastModifiedBy, Types::String.default("root".freeze) | ||
attribute :dlpsDeleted, Types::String.default("f".freeze) | ||
|
||
associations do | ||
belongs_to :user, foreign_key: :userid | ||
belongs_to :group, foreign_key: :user_grp | ||
end | ||
end | ||
|
||
struct_namespace Lauth | ||
auto_struct true | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Lauth | ||
module Persistence | ||
module Relations | ||
class Groups < ROM::Relation[:sql] | ||
schema(:aa_user_grp, infer: true, as: :groups) do | ||
# attribute :lastModifiedTime, Types::Time.default { Time.now } | ||
# attribute :manager, Types::Integer.default(0) | ||
attribute :lastModifiedBy, Types::String.default("root".freeze) | ||
attribute :dlpsDeleted, Types::String.default("f".freeze) | ||
|
||
associations do | ||
has_many :grants, foreign_key: :user_grp | ||
has_many :group_memberships, foreign_key: :user_grp | ||
end | ||
end | ||
|
||
struct_namespace Lauth | ||
auto_struct true | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Factory.define(:group, struct_namespace: Lauth) do |f| | ||
f.sequence(:uniqueIdentifier) { |n| n } | ||
f.sequence(:commonName) { |n| "Group #{n}" } | ||
f.manager 0 | ||
f.lastModifiedTime Time.now | ||
f.lastModifiedBy "root" | ||
f.dlpsDeleted "f" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Factory.define(:group_membership, struct_namespace: Lauth) do |f| | ||
f.association(:user) | ||
f.association(:group) | ||
f.lastModifiedTime Time.now | ||
f.lastModifiedBy "root" | ||
f.dlpsDeleted "f" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters